# -*- coding:utf-8 -*-

from .pkg_helper import PkgHelperInterface
from src.utils import runcmd
from src.core import macro

RPM_NAMES = "openEuler-indexhtml"
SPEC_NAMES = "generic-indexhtml.spec"


class PkgIndexHtml(PkgHelperInterface):
    def __init__(self, vendor_src):
        self._spec_names = SPEC_NAMES
        runcmd.rpm_src_setup(vendor_src + "/" + RPM_NAMES + "*")

    def replace_vendor(self):
        _spec = macro.RPM_SRC_SETUP_SPEC_PATH + self._spec_names
        runcmd.replace(_spec, "Provides:",
                       "Provides: openEuler-indexhtml\nProvides:", 1)

    def replace_rpm(self):
        pass


